# -*-coding = utf-8 -*-

# @Time: 2021/4/2 22:27
# @Author: bistro
# @File: p1006.py
# @Software: PyCharm

class Solution:
    def clumsy(self, N: int) -> int:
        sub_jj_total = 0
        sub_cu_total = 0
        cu_total = 0
        count = N // 4  # 次数
        remain = N % 4  # 余数
        if count == 0:
            return self.judgeRemainder(remain)
        for i in range(count):
            bitch = N - 4 * i
            if i == 0:
                cu_total += bitch*(bitch-1)//(bitch-2)
            else:
                sub_cu_total += bitch*(bitch-1)//(bitch-2)
            sub_jj_total += bitch-3
        return cu_total - sub_cu_total + sub_jj_total - self.judgeRemainder(remain)

    @staticmethod
    def judgeRemainder(remain):
        if remain == 3:
            return 3*2//1
        elif remain == 2:
            return 2*1
        elif remain == 1:
            return 1
        else:
            return 0


"""
测试用例
s = Solution()
print(s.clumsy(10))
"""